package com.src.iseclive.mvp.presenter.implement;


import com.src.isec.domain.entity.UserEntity;
import com.src.isec.domain.interactor.UsersUesCase;
import com.src.iseclive.di.socpe.ActivityScope;
import com.src.iseclive.mvp.presenter.BasePresenter;
import com.src.iseclive.mvp.view.ISecondView;
import com.src.iseclive.utils.RxLifecycleUtils;

import org.reactivestreams.Subscription;

import java.util.List;

import javax.inject.Inject;

import io.reactivex.FlowableSubscriber;
import io.reactivex.Observer;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable;
import io.reactivex.schedulers.Schedulers;

/**
 * @author liujiancheng
 * @name IsecLive
 * @class name：com.src.iseclive.mvp.presenter.implement
 * @class describe
 * @time 2018/3/20 16:41
 * @change
 * @chang time
 * @class describe
 */
@ActivityScope
public class SecondPresenter extends BasePresenter<ISecondView> {

    private UsersUesCase mUsersUesCase;


    @Inject
    public SecondPresenter(UsersUesCase usersUesCase) {
        super();
        mUsersUesCase = usersUesCase;

    }


    public void getUsers(int lastIdQueried, int prePage) {

        mUsersUesCase.execute(UsersUesCase.Params.get(lastIdQueried, prePage)).subscribeOn
                (Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).compose
                (RxLifecycleUtils.bindToLifecycle(mRootView)).subscribe(new Observer<List<UserEntity>>() {


            @Override
            public void onSubscribe(Disposable d) {

            }

            @Override
            public void onNext(List<UserEntity> userEntities) {


                if (userEntities != null && userEntities.size() > 0) {
                    
                }

            }

            @Override
            public void onError(Throwable e) {

            }

            @Override
            public void onComplete() {

            }
        });


    }


    @Override
    public void onStart() {

    }

    @Override
    public void onDestroy() {

    }
}
